{# Generic template for rendering an Atom feed given a feed dict.

The feed dict should be a logical representation of an Atom feed as a Python
dict, including a list of dicts for the feed's entries. This template will
render the feed to Atom XML.

-#}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>{{ feed.id }}</id>
  <title>{{ feed.title }}</title>
  <subtitle>{{ feed.subtitle }}</subtitle>
  <updated>{{ feed.updated }}</updated>

  {% for link in feed.links %}
  <link rel="{{ link.rel }}"{% if link.type %} type="{{ link.type }}"{% endif %} href="{{ link.href }}" />
  {% endfor %}

  {% for entry in feed.entries %}
  <entry>
    <id>{{ entry.id }}</id>
    <title>{{ entry.title }}</title>
    <updated>{{ entry.updated }}</updated>
    <published>{{ entry.published }}</published>
    <author>
      <name>{{ entry.author.name }}</name>
    </author>
    {% for link in entry.links %}
    <link rel="{{ link.rel }}"{% if link.type %} type="{{ link.type }}"{% endif %} href="{{ link.href }}" />
    {% endfor %}
    <content type="html">
        {# This is already HTML-escaped in Python, so we don't escape it again
           here. #}
        {{ entry.content|safe }}
    </content>
  </entry>
  {% endfor %}
</feed>
